package com.kaifamiao.thread.d0928;

import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class Demo06 {

    public static void main(String[] args) {
        AtomicInteger num = new AtomicInteger();

        new Thread(() -> {
            System.out.println(num.getAndIncrement());
            throw new NullPointerException("aaa");
        }, "输出 aaa 的线程").start();


//        System.out.println(num.get()); // 获取值
//        System.out.println(num.getAndIncrement()); // 获取值并自增  num ++
//        System.out.println(num.get()); // 1
//        System.out.println(num.incrementAndGet()); // 自增再获取  ++ num
    }
}
